package vip.zhenzicheng.design_patterns.combination;

/**
 * 菜单项类 属于叶子节点
 *
 * @author zhenzicheng
 * @date 2022-05-26 16:54
 */
public class MenuItem extends MenuComponent {

  public MenuItem(String name, int level) {
    this.name = name;
    this.level = level;
  }

  public void print() {
    //打印菜单项的名称
    for (int i = 0; i < level; i++) {
      System.out.print("--");
    }
    System.out.println(name);
  }
}
